package com.lz.message.redis;

import javax.annotation.Resource;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Component
@Order(1)
public class MsgApplicationRunner implements ApplicationRunner{

	@Resource
	private Consumer consumer; 
	
	@Resource
	private MessageCopy messageCopy;
	
	public void run(ApplicationArguments args) throws Exception {
		
		Thread msgCopyThread = new Thread(messageCopy, "msgCopy");
		msgCopyThread.start();
		
		Thread consumerThread = new Thread(consumer, "msgConsumer");
		consumerThread.start();
		
	}

}
